﻿<%@ include file="../include/top.jsp"%>
<%@ include file="../include/errorArea.jsp" %>
<link rel="stylesheet" href="${baseURL}/css/zTreeStyle/zTreeStyle.css" type="text/css">
<script language="javascript" type="text/javascript" src="${baseURL}/js/jquery.ztree.all-3.5.min.js">
</script>
<script src="${baseURL}/shop/js/calendar.js"></script>

<SCRIPT type="text/javascript">
	var setting = {
		view: {
			dblClickExpand: false
		},
		data: {
			simpleData: {
				enable: true
			}
		},
		callback: {
			onClick: onClick
		}
	};

	var zNodes = ${treedata}; //后台返回的数据

	function onClick(e,treeId, treeNode) {
		var zTree = $.fn.zTree.getZTreeObj("treeDemo");
		zTree.expandNode(treeNode);

		//叶节点，并且不是第一层节点(第一层节点的pId是null)
		//if(!treeNode.isParent && treeNode.pId!=null){
			nodes = zTree.getSelectedNodes();
			$("#selectedNodeName").attr("value", treeNode.name);
			$("#nodeId").attr("value", treeNode.id);
		//}
	}

	function showMenu() {
		var cityObj = $("#selectedNodeName");
		var cityOffset = $("#selectedNodeName").offset();
		$("#menuContent").css({left:cityOffset.left + "px", top:cityOffset.top + cityObj.outerHeight() + "px"}).slideDown("fast");

		$("body").bind("mousedown", onBodyDown);
	}
	function hideMenu() {
		$("#menuContent").fadeOut("fast");
		$("body").unbind("mousedown", onBodyDown);
	}
	function onBodyDown(event) {
		if (!(event.target.id == "menuBtn" || event.target.id == "selectedNodeName" || event.target.id == "menuContent" || $(event.target).parents("#menuContent").length>0)) {
			hideMenu();
		}
	}

	$(document).ready(function(){
		$.fn.zTree.init($("#treeDemo"), setting, zNodes);
		
		var treeObj = $.fn.zTree.getZTreeObj("treeDemo");
		var nodes = treeObj.getNodesByParam("id", "${formdata.nodeId}", null);
		if (nodes.length>0) {
			treeObj.selectNode(nodes[0]);
		}

	});
</SCRIPT>

  <form action="" method="get" name="searchForm" id="searchForm">
    <input type="hidden" name="p" value="1" />
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1">
  <tr>
    <td height="5" colspan="2"></td>
  </tr>

    <tr>
      <td height="20" align="left" valign="middle">
      <img src="${baseURL}/images/009.png" width="16" height="16" align="absmiddle" />
      &nbsp;搜索条件：&nbsp;
      </td>
    </tr>
    <tr>
      <td height="20" align="left" valign="middle">
  		订单编号：<input name="orderCode" type="text" class="button" id="orderCode"
			value="${formdata.orderCode}" size="10"/>    
      	商品名称：
        <input name="keyword" type="text" class="button" id="keyword"
			value="${formdata.keyword}" size="20"/>
			所属分类：
			<input type="hidden" name="nodeId" id="nodeId" value="${formdata.nodeId}"/>
			<input name="selectedNodeName" id="selectedNodeName" type="text" readonly value="${formdata.selectedNodeName}" size="40" onclick="showMenu()"/>
			<div id="menuContent" class="menuContent" style="display:none; position: absolute;">
				<ul id="treeDemo" class="ztree" style="margin-top:0; width:300px;"></ul>
			</div>
		
      </td>
    </tr>
    <tr>
    <td>
    	下单时间：
                              
           		<input id="startTime" name="startTime" onclick="calendar.show(this);" value="${formdata.startTime}" type="text" class="sell-textinput-02"><strong>到</strong>
 				<input id="endTime" name="endTime" onclick="calendar.show(this);" value="${formdata.endTime}" type="text" class="sell-textinput-02">
                               
  		订单状态：<select id="status" name="status" style="width:100px">
						<option value="">全部</option>
						<option value="1" ${formdata.status=="1"?"selected":""}>未发货</option>
						<option value="2" ${formdata.status=="2"?"selected":""}>已发货</option>
						<option value="3" ${formdata.status=="3"?"selected":""}>已完成</option>
					</select>    
    </td>
    </tr>
    <tr>
      <td height="20" align="center" valign="middle">
      <input name="image" type="image" id="Image8" onmouseover="MM_swapImage('Image8','','${baseURL}/images/button_ss_a.jpg',1)" onmouseout="MM_swapImgRestore()" src="${baseURL}/images/button_ss.jpg"/>
      &nbsp;&nbsp;&nbsp;&nbsp;
      <img src="${baseURL}/images/button_qk.jpg" name="clearButton" id="clearButton" style="cursor:pointer" onclick="clearInput()" onmouseover="MM_swapImage('clearButton','','${baseURL}/images/button_qk_a.jpg',1)" onmouseout="MM_swapImgRestore()"/>
      </td>
    </tr>
  <tr>
    <td height="5" colspan="2"></td>
  </tr>
  <tr>
    <td height="1" colspan="2" bgcolor="#A6CAE8"></td>
  </tr>
  <tr>
    <td height="5" colspan="2" class="text_gray2"></td>
  </tr>
</table>
  </form>
<script>
$("#supplierId").val("${formdata.supplierId}");

function clearInput() {
	document.getElementById("status").options[0].selected=true;
	document.getElementById("orderCode").value = "";
	document.getElementById("keyword").value = "";
	document.getElementById("nodeId").value = "";
	document.getElementById("selectedNodeName").value = "";
	document.getElementById("startTime").value = "";
		document.getElementById("endTime").value = "";
}

function selectAll(checkAllFlag) {
	var checkArray = document.getElementsByName("chk");
	for (var i = 0; i < checkArray.length; i++) {
		checkArray[i].checked = checkAllFlag;
	}
}
</script>
<c:if test="${empty obj.list}">
<div align="center"><b>没有符合条件的记录。</b></div>
</c:if>
<c:if test="${not empty obj.list}">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" id="listOutTable">
  <tr>
    <td colspan="2" align="left" valign="middle" class="text_gray2"><table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#96bee2">
      <tr>
        <td height="21" background="${baseURL}/images/table_bg.jpg">&nbsp;&nbsp;
        <span class="text_blue_b">
        <img src="${baseURL}/images/008.png" width="16" height="16" align="absmiddle" />&nbsp;商品列表：</span></td>
      </tr>
      <tr>
        <td height="13" valign="top" bgcolor="#FFFFFF">
        <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF" id="listTable">
	<tr align="center" bgcolor="#eeeeee">
		<td width="35%">商品名称</td>		
		<td width="8%">商品图片</td>
		<td width="8%">商品定价</td>
		<td width="8%">库存数量</td>
		<td width="8%">销售数量</td>
		<td width="8%">订单编号</td>
		<td width="8%">下单时间</td>
		<td width="8%">订单状态</td>
	</tr>
	<c:forEach var="row" items="${obj.list}"> 
	<tr align="center">
			<td align="left">${row.productName}</td>
			<td><img src="${row.productPic}" height="30" width="30"/></td>
			<td align="right">${row.supplierPrice}</td>
			<td align="right">${row.stockNumber}</td>
			<td align="right">${row.productCount}</td>
			<td><a onclick="preCreateComment(${row.orderId});" href="#" class="ctrlLink">${row.code}</a></td>
			 <td><fmt:formatDate value="${row.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
			<td><c:if test="${row.status==1}"><font color="red">未发货</font></c:if>
				<c:if test="${row.status==2}"><font color="yellow">已发货</font></c:if>
			<c:if test="${row.status==3}"><font color="green">已完成</font></c:if>
			</td>
			</tr> 
                </c:forEach>
        </table>
        </td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td height="1" colspan="2" bgcolor="#A6CAE8"></td>
  </tr>
  <tr>
    <td height="25" colspan="2"><%@ include file="../include/listpage.jsp"%>
    </td>
  </tr>
  <tr>
    <td height="1" colspan="2" bgcolor="#A6CAE8"></td>
  </tr>
</table>
<script src="${ctx}/js/listProduct.js"></script>
</c:if>
<script type="text/javascript">
function preCreateComment(commentId){
	$.layer({
	    type: 2,
	    maxmin: true,
	    shadeClose: true,
	    title: '订单详情',
	    shade: [0.1,'#fff'],
	    offset: [($(window).height() / 10)+'px',''],
	    area: ['600px', '400px'],
	    iframe: {src: '${ctx}/supplierProduct/buyOrderDetail?orderCode='+commentId}
	}); 
}
</script>
<%@ include file="../include/bottom.jsp"%>